<template>
  <div>
    <el-row :gutter="0" class="rowSty">
      <el-col :span="12" v-for="(o) in goods" :key="o.id" style="margin-top:20px; padding: 14px;">
         <router-link :to="'/home/goods/'+o.id" >
         
        <el-card :body-style="{ padding: '10px' ,width:'80%',height: '300px','overflow-y': 'hidden', border:'2px' }">
          <el-row>
            <el-col :span="12">
              <div style="padding: 14px;">
                <span>
                  <h2>{{o.titile}}</h2>
                </span>
                <img
                  :src="o.imgurl"
                  class="image"
                />
              </div>
            </el-col>
            <el-col :span="12">
              <div>
                <span class="detailsSt">{{o.details}}</span>
              </div>
            </el-col>
          </el-row>
        </el-card>
         </router-link>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import http from "../../utils/https";
import DocumentDetails from "./documentDetails";
export default {
  name: "Goods",
  data() {
    return {
      o: "",
      currentDate: new Date(),
      goods: [
        {
          id: "",
          titile: "",
          imgurl: "",
          details: "",
          sort: 0,
          createDate: "",
          createId: ""
        }
      ]
    };
  },

  beforeCreate() {},

  created() {},

  watch: {
    $route(to, from) {
      console.log("zzzzzzzzzzzzzzzzzzzzzzz");
    }
  },

  beforeMount() {
    http
      .get({
        url: "/yjl/goods/all"
      })
      .then(res => {
        console.log(res);
        if (res.code == 200) {
          this.goods = res.content;
          console.log(this.goods);
        } else {
          alert("接口异常");
        }
      })
      .catch(res => {
        console.log(res);
      });

    console.log("1231111111111123");
  },

  mounted() {
    // http.post({
    //   url:'/api/yjl/user/login',
    //   data: {
    //     username: 'goutian',
    //     password: '1234',
    //   }
    // }).then(res => {
    //   console.log(res)
    // }).catch(err => {
    //   console.log(err)
    // })
  },

  beforeUpdate() {},

  updated() {
    console.log("123111111111111123");
  },

  beforeDestroy() {},

  destroyed() {},

  activated() {},

  deactivated() {},

  methods: {},

  computed: {}
};
</script>

<style>
/* .el-colo-6{
  display: flex;
} */

.margClass {
  width: 80%;
}
.search {
  width: 70%;
}
.time {
  font-size: 13px;
  color: #999;
}

.bottom {
  margin-top: 13px;
  line-height: 12px;
}

.button {
  padding: 0;
  float: right;
}

.image {
  width: 100%;
  height: 188px;
  display: block;
}
.detailsSt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 15; /* 显示三行，后面省略 */
  overflow: hidden;
}

.rowSty {
  padding: 20px;
}

.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}

.clearfix:after {
  clear: both;
}
</style>
